package logic

import "github.com/golang-jwt/jwt/v5"

const MESSAGE_TYPE_JOIN = "after_open"
const MESSAGE_TYPE_QUIT = "after_close"
const MESSAGE_TYPE_FD_INFO = "fd_info"
const MESSAGE_TYPE_PING = "PING"

// 用于推送用户登入，登出
const QUEUE_PULL_MESSAGE = "PullServerQueue_%s"

// 用于接收消息推送，每个容器（服务）一个队列，占位符为当前容器 Hostname
const QUEUE_PUSH_MESSAGE = "PushServerQueue_%s"

// 业务消息结构
type ContentMessage struct {
	Type  string `json:"type"`
	Token string `json:"token"`
}

type RegisterMessage struct {
	Fd      string         `json:"fd"`
	Content ContentMessage `json:"content"`
}

type UserInfo struct {
	User User `json:"user"`
	jwt.RegisteredClaims
}

type User struct {
	Id       int    `json:"id"`
	UserName string `json:"username"`
	Source   string `json:"source"`
	Roles    string `json:"roles"`
	Channel  string `json:"channel"`
}

type PushMessage struct {
	Fd      string `json:"fd"`
	Content string `json:"content"`
}
